﻿#include "TcpCodec_Register.h"

#include "TcpCodec.h"
#include "UserRegisterCodec.h"

TcpCodec_Register::TcpCodec_Register()
{

}

TcpCodec_Register::~TcpCodec_Register()
{

}

void TcpCodec_Register::decode(DataPackage_TcpCodec* dataPackageInfo_User)
{
  userRegisterCodec->decode(dataPackageInfo_User->getData());
}

TcpCodec* TcpCodec_Register::getTcpCodec()const
{
  return tcpCodec;
}

TcpCodec_Register* TcpCodec_Register::setTcpCodec(TcpCodec* const tcpCodec)
{
  this->tcpCodec=tcpCodec;
  tcpCodec->addToCodecMap(TcpCodec_Register::Register,this);
  printInjection(this,tcpCodec);
  return this;
}


UserRegisterCodec* TcpCodec_Register::getUserRegisterCodec()const
{
  return userRegisterCodec;
}

TcpCodec_Register* TcpCodec_Register::setUserRegisterCodec(UserRegisterCodec * const userRegisterCodec)
{
  this->userRegisterCodec=userRegisterCodec;
  printInjection(this,userRegisterCodec);
  return this;
}

void TcpCodec_Register::objectAutoInjection(QHash<QString,QObject*>* objMap)
{
  setTcpCodec(getObjFromMap<TcpCodec>(objMap));
  setUserRegisterCodec(getObjFromMap<UserRegisterCodec>(objMap));
}
